#include <stdio.h>
#include "array_stack.h"

#define N 10

int main()
{
    astack_t *stack = NULL;
    int ret, top, tmp;

    ret = astack_init(&stack, N, sizeof(int));
    if (ret != 0) {
        printf("初始化失败\n");
        return -1;
    }

    printf("is empty：%d\n", astack_empty(stack));

    for (ret = 1; ret <= N; ret++)
        astack_push(stack, &ret);

    printf("is empty：%d\n", astack_empty(stack));
    printf("cap %d\n", stack->capacity);
    printf("top %d\n", stack->top);

    top = stack->top;
    for (ret = 0; ret < top; ret++) {
        astack_pop(stack, &tmp);
        printf("%d ", tmp);
    }
    printf("\n");

    astack_destroy(&stack);

    return 0;
}
